<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>GameEngine: C:/Users/Axel/Desktop/informatica/Projects/Workspace C++/Game Engine/src/StateManagement/StateManager.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">GameEngine
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_state_manager_8cpp_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Macros</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">StateManager.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_state_manager_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * StateManager.cpp</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> *  Created on: 15 Nov 2013</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *      Author: axel</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_state_manager_8h.html">StateManager.h</a>&quot;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;</div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div>
<div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="class_state_manager.html#a3671a7c516e46d8e85048fc7808ce3ad">   11</a></span>&#160;<a class="code" href="class_state_manager.html#a3671a7c516e46d8e85048fc7808ce3ad">StateManager::StateManager</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;{</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;    <a class="code" href="class_state_manager.html#a4223790502653f0c4f788492657e2efe">currentcode</a> = 0;</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;    <a class="code" href="class_state_manager.html#a39d1a1ef04855e4c6d4d883345d820fa">codes</a> = <span class="keyword">new</span> <a class="code" href="class_key_code.html">KeyCode</a>();</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;}</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div>
<div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="class_state_manager.html#a7c8cc451501d7883ffc28b60d7f4c559">   18</a></span>&#160;<a class="code" href="class_state_manager.html#a7c8cc451501d7883ffc28b60d7f4c559">StateManager::~StateManager</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;{</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;}</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div>
<div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="class_state_manager.html#ae7672f878bc520a29723feac8dc19131">   22</a></span>&#160;<a class="code" href="class_state_machine.html">StateMachine</a>* <a class="code" href="class_state_manager.html#ae7672f878bc520a29723feac8dc19131">StateManager::initialiseState</a>() {</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    <a class="code" href="class_state_manager.html#a39d1a1ef04855e4c6d4d883345d820fa">codes</a>-&gt;<a class="code" href="class_key_code.html#abc73015eb41e96b5e0787f2495ad2985">getHashMap</a>()[200000000]-&gt;reInit();</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_state_manager.html#a39d1a1ef04855e4c6d4d883345d820fa">codes</a>-&gt;<a class="code" href="class_key_code.html#abc73015eb41e96b5e0787f2495ad2985">getHashMap</a>()[200000000];</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;}</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;</div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="class_state_manager.html#abab37054bb4884e50618d4befa12eaf3">   27</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_state_manager.html#abab37054bb4884e50618d4befa12eaf3">StateManager::changePlacesBeen</a>(<span class="keywordtype">long</span> code, <a class="code" href="class_state_machine.html">StateMachine</a>* machine) {</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    <a class="code" href="class_state_manager.html#adb63b5c570c88ecc53dcaa60bc917a31">placesbeen</a>[code]=machine;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;}</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="class_state_manager.html#a901fef986fdd19cccbef719c929ba89f">   31</a></span>&#160;<a class="code" href="class_state_machine.html">StateMachine</a>* <a class="code" href="class_state_manager.html#a901fef986fdd19cccbef719c929ba89f">StateManager::getStateValue</a>(<span class="keywordtype">long</span> code) {</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_state_manager.html#adb63b5c570c88ecc53dcaa60bc917a31">placesbeen</a>[code];</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;}</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="class_state_manager.html#ada4df5f0156c3f811fc2fb4fb4991d8f">   35</a></span>&#160;<a class="code" href="class_state_machine.html">StateMachine</a>* <a class="code" href="class_state_manager.html#ada4df5f0156c3f811fc2fb4fb4991d8f">StateManager::callStates</a>(<span class="keywordtype">long</span> code, <span class="keywordtype">long</span> oldcode, <a class="code" href="class_state_machine.html">StateMachine</a>* oldmachine) {</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    <a class="code" href="class_state_machine.html">StateMachine</a>* machine;</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    <span class="keywordflow">if</span> (<a class="code" href="class_state_manager.html#a39d1a1ef04855e4c6d4d883345d820fa">codes</a>-&gt;<a class="code" href="class_key_code.html#ac7a987f95d9ec1a77b97b472d607160d">getSpecial</a>().count(code)){</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;        machine =  <a class="code" href="class_state_manager.html#adb63b5c570c88ecc53dcaa60bc917a31">placesbeen</a>[<a class="code" href="class_state_manager.html#a4223790502653f0c4f788492657e2efe">currentcode</a>];</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    }</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <span class="keywordflow">else</span>{</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;        <span class="keywordflow">if</span> (<a class="code" href="class_state_manager.html#adb63b5c570c88ecc53dcaa60bc917a31">placesbeen</a>.count(code)){</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;            machine = <a class="code" href="class_state_manager.html#adb63b5c570c88ecc53dcaa60bc917a31">placesbeen</a>[code];</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        }</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        <span class="keywordflow">else</span>{</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;            machine = <a class="code" href="class_state_manager.html#a39d1a1ef04855e4c6d4d883345d820fa">codes</a>-&gt;<a class="code" href="class_key_code.html#abc73015eb41e96b5e0787f2495ad2985">getHashMap</a>()[code];</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;        }</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;    }</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    <a class="code" href="class_state_manager.html#a4223790502653f0c4f788492657e2efe">currentcode</a>=oldcode;</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    <a class="code" href="class_state_manager.html#abab37054bb4884e50618d4befa12eaf3">changePlacesBeen</a>(oldcode,oldmachine);</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    machine-&gt;<a class="code" href="class_state_machine.html#aec67074ebf4261300ba77d216ac156bd">reInit</a>();</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <span class="keywordflow">return</span> machine;</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    <span class="comment">//check if special</span></div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="comment">//if true --&gt; we need to trace back to last known pos</span></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <span class="comment">//from and too completly different places</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="comment">//search placesbeen</span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <span class="comment">//we are tracing back to another place</span></div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <span class="comment">//else search in codes</span></div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    <span class="comment">//new place</span></div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;}</div>
<div class="ttc" id="class_state_machine_html"><div class="ttname"><a href="class_state_machine.html">StateMachine</a></div><div class="ttdef"><b>Definition:</b> <a href="_state_machine_8h_source.html#l00014">StateMachine.h:14</a></div></div>
<div class="ttc" id="class_key_code_html_abc73015eb41e96b5e0787f2495ad2985"><div class="ttname"><a href="class_key_code.html#abc73015eb41e96b5e0787f2495ad2985">KeyCode::getHashMap</a></div><div class="ttdeci">std::map&lt; long, StateMachine * &gt; getHashMap()</div><div class="ttdef"><b>Definition:</b> <a href="_key_code_8cpp_source.html#l00037">KeyCode.cpp:37</a></div></div>
<div class="ttc" id="class_state_manager_html_a901fef986fdd19cccbef719c929ba89f"><div class="ttname"><a href="class_state_manager.html#a901fef986fdd19cccbef719c929ba89f">StateManager::getStateValue</a></div><div class="ttdeci">StateMachine * getStateValue(long code)</div><div class="ttdef"><b>Definition:</b> <a href="_state_manager_8cpp_source.html#l00031">StateManager.cpp:31</a></div></div>
<div class="ttc" id="class_state_manager_html_a7c8cc451501d7883ffc28b60d7f4c559"><div class="ttname"><a href="class_state_manager.html#a7c8cc451501d7883ffc28b60d7f4c559">StateManager::~StateManager</a></div><div class="ttdeci">~StateManager(void)</div><div class="ttdef"><b>Definition:</b> <a href="_state_manager_8cpp_source.html#l00018">StateManager.cpp:18</a></div></div>
<div class="ttc" id="class_state_manager_html_ae7672f878bc520a29723feac8dc19131"><div class="ttname"><a href="class_state_manager.html#ae7672f878bc520a29723feac8dc19131">StateManager::initialiseState</a></div><div class="ttdeci">StateMachine * initialiseState()</div><div class="ttdef"><b>Definition:</b> <a href="_state_manager_8cpp_source.html#l00022">StateManager.cpp:22</a></div></div>
<div class="ttc" id="class_state_manager_html_a4223790502653f0c4f788492657e2efe"><div class="ttname"><a href="class_state_manager.html#a4223790502653f0c4f788492657e2efe">StateManager::currentcode</a></div><div class="ttdeci">long currentcode</div><div class="ttdef"><b>Definition:</b> <a href="_state_manager_8h_source.html#l00029">StateManager.h:29</a></div></div>
<div class="ttc" id="class_state_manager_html_adb63b5c570c88ecc53dcaa60bc917a31"><div class="ttname"><a href="class_state_manager.html#adb63b5c570c88ecc53dcaa60bc917a31">StateManager::placesbeen</a></div><div class="ttdeci">std::map&lt; long, StateMachine * &gt; placesbeen</div><div class="ttdef"><b>Definition:</b> <a href="_state_manager_8h_source.html#l00027">StateManager.h:27</a></div></div>
<div class="ttc" id="class_state_machine_html_aec67074ebf4261300ba77d216ac156bd"><div class="ttname"><a href="class_state_machine.html#aec67074ebf4261300ba77d216ac156bd">StateMachine::reInit</a></div><div class="ttdeci">virtual void reInit()=0</div></div>
<div class="ttc" id="_state_manager_8h_html"><div class="ttname"><a href="_state_manager_8h.html">StateManager.h</a></div></div>
<div class="ttc" id="class_state_manager_html_a39d1a1ef04855e4c6d4d883345d820fa"><div class="ttname"><a href="class_state_manager.html#a39d1a1ef04855e4c6d4d883345d820fa">StateManager::codes</a></div><div class="ttdeci">KeyCode * codes</div><div class="ttdef"><b>Definition:</b> <a href="_state_manager_8h_source.html#l00026">StateManager.h:26</a></div></div>
<div class="ttc" id="class_state_manager_html_ada4df5f0156c3f811fc2fb4fb4991d8f"><div class="ttname"><a href="class_state_manager.html#ada4df5f0156c3f811fc2fb4fb4991d8f">StateManager::callStates</a></div><div class="ttdeci">StateMachine * callStates(long code, long oldcode, StateMachine *oldmachine)</div><div class="ttdef"><b>Definition:</b> <a href="_state_manager_8cpp_source.html#l00035">StateManager.cpp:35</a></div></div>
<div class="ttc" id="class_key_code_html_ac7a987f95d9ec1a77b97b472d607160d"><div class="ttname"><a href="class_key_code.html#ac7a987f95d9ec1a77b97b472d607160d">KeyCode::getSpecial</a></div><div class="ttdeci">std::map&lt; long, int &gt; getSpecial()</div><div class="ttdef"><b>Definition:</b> <a href="_key_code_8cpp_source.html#l00040">KeyCode.cpp:40</a></div></div>
<div class="ttc" id="class_key_code_html"><div class="ttname"><a href="class_key_code.html">KeyCode</a></div><div class="ttdef"><b>Definition:</b> <a href="_key_code_8h_source.html#l00023">KeyCode.h:23</a></div></div>
<div class="ttc" id="class_state_manager_html_abab37054bb4884e50618d4befa12eaf3"><div class="ttname"><a href="class_state_manager.html#abab37054bb4884e50618d4befa12eaf3">StateManager::changePlacesBeen</a></div><div class="ttdeci">void changePlacesBeen(long code, StateMachine *machine)</div><div class="ttdef"><b>Definition:</b> <a href="_state_manager_8cpp_source.html#l00027">StateManager.cpp:27</a></div></div>
<div class="ttc" id="class_state_manager_html_a3671a7c516e46d8e85048fc7808ce3ad"><div class="ttname"><a href="class_state_manager.html#a3671a7c516e46d8e85048fc7808ce3ad">StateManager::StateManager</a></div><div class="ttdeci">StateManager(void)</div><div class="ttdef"><b>Definition:</b> <a href="_state_manager_8cpp_source.html#l00011">StateManager.cpp:11</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_f2115474ceecb9750a532ae1d1228ee1.html">StateManagement</a></li><li class="navelem"><a class="el" href="_state_manager_8cpp.html">StateManager.cpp</a></li>
    <li class="footer">Generated on Fri Dec 13 2013 19:38:40 for GameEngine by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li>
  </ul>
</div>
</body>
</html>
